import React from 'react';
import { Icon } from 'weaver-mobile';
import * as Common from '../../util/common';
import { transQueryParams } from '../../util/forwardPage';
const jQuery = window.jQuery;

export default class ErrorMsg extends React.Component{
    constructor(){
        super();
    }
    componentDidMount(){
        jQuery(".wf-error-msg-detail").find("a.detail_request_link").each(function(){
            const params = transQueryParams(jQuery(this).attr("href"));
            jQuery(this).removeAttr("href").removeAttr("target").bind("click", function(){
                Common.showFormReq(params.requestid, params);
            });
        });
    }
    render(){
        const { title,detail,bottom } = this.props;
        return (
            <div className="wf-error-msg">
                <div className="wf-error-msg-title">
                    <Icon type="warning" />
                    <span>{title}</span>
                </div>
                {detail &&<div className="wf-error-msg-detail" dangerouslySetInnerHTML={{__html:detail}}></div>}
                {
                    bottom && <div className="wf-error-msg-bottom" dangerouslySetInnerHTML={{__html:bottom}}></div>
                }
            </div>
        )
    }
}